Ext.namespace('EasyExt.grid');

EasyExt.grid.PageSizePlugin = function() {
	EasyExt.grid.PageSizePlugin.superclass.constructor.call(this, {
		store: new Ext.data.SimpleStore({
			fields: ['text', 'value'],
			data: [['15', 15], ['25', 25], ['35', 35], ['50', 50], ['100', 100]]
		}),
		mode: 'local',
		displayField: 'text',
		valueField: 'value',
		editable: false,
		allowBlank: false,
		triggerAction: 'all',
		width: 50
	});
};

Ext.extend(EasyExt.grid.PageSizePlugin, Ext.form.ComboBox, {

	init : function(paging) {
		paging.on('render', this.onInitView, this);
	},

	onInitView : function(paging) {
		paging.add('-', this, '');
		this.setValue(paging.pageSize);
		this.on('select', this.onPageSizeChanged, paging);
	},

	onPageSizeChanged : function(combo) {
		this.pageSize = parseInt(combo.getValue());
		compage = parseInt(combo.getValue());
		this.doLoad(0);
	}
});

Ext.reg('pagesizecombo', EasyExt.grid.PageSizePlugin);